---
title: Retrieve policy data
summary: Loads the core policy view aggregate for a policy number via the BOF data portal.
status: draft
owner: SAIF Corporation
last_reviewed: 2026-09-01
library: SAIF.Business.View.Policy
reference_type: embedded
operation_id: op-01-retrieve-policy-data
trigger: Consumer calls GetPolicyData
---

# Retrieve policy data

Loads the core policy view aggregate for a policy number, returning a populated `clsPolicyData`.

| Field | Value |
| --- | --- |
| **Operation ID** | op-01-retrieve-policy-data |
| **Trigger** | Consumer calls `GetPolicyData(inDataportal, inPolicyNum)` (or the `Criteria`, policy-number-list, or user-access-level overloads) |
| **Inputs** | Policy number, optional period date/user context/detail flag |
| **Outputs** | Populated `clsPolicyData` |
| **Primary components** | `clsPolicyData.GetPolicyData`, `Criteria`, `BeforeRetrieve`/`AfterRetrieve` |
| **Entry point** | `SAIF.Business.View.Policy/clsPolicyData.vb` |

## Steps

1. Caller invokes one of the shared `GetPolicyData` overloads. All overloads ultimately construct a `Criteria` (or accept one directly) and delegate to `inDataportal.DataAccessLayer.RetrieveObject`.
2. Framework invokes `BeforeRetrieve`: creates a new `IDataRequest`, sets `CommandType = StoredProcedure` and `RequestType = Reader`, assigns `MyCriteria.RetrieveSQL` ([SQL-010](../sql/SQL-010-getpolicy.md), stored procedure `pk73094_policy_data.getpolicy`), and binds parameter `apolicynum` from `MyCriteria.PolicyNum` plus a cursor parameter `recordset` ([BR-VP-001](../business-rules.md#br-vp-001-policy-number-must-be-valid-before-retrieve)).
3. Framework executes the request against Oracle.
4. Framework invokes `AfterRetrieve`: casts `inPortalRequest.DataRequest(0).Result` to `clsSAIFDataReader`, calls `Reader.Read()`, and if a row was returned calls `Fill(Reader)` to hydrate all `clsPolicyData` fields (including market-type mapping — [BR-VP-016](../business-rules.md#br-vp-016-market-type-mapping)), then calls `MarkOld()`.
5. If the reader produced no row, `Fill` is never called and the returned `clsPolicyData` is left in its unpopulated default state — the caller is not told the policy did not exist except by inspecting `IsValid`/`PolicyNum`.*
6. The `GetPolicyData(inDataportal, inPolicyNumbers)` overload loops the single-policy overload for each number via `PerformForAll`, building a `List(Of clsPolicyData)` — retrieval is not batched at the SQL level.*
7. The `GetPolicyAddress` / `GetPolicyClaimAddress` shared helpers on `clsPolicyData` are thin pass-throughs to `clsPolicyAddress.GetPolicyAddress` / `GetPolicyClaimAddress` (see [Retrieve addresses](op-06-retrieve-addresses.md)) — they do not go through this operation's `Criteria`/`BeforeRetrieve` path.

## Process flow

```mermaid
flowchart TD
	Start(["Caller invokes<br>GetPolicyData"]) --> A["Construct/accept Criteria<br>with policy number"]
	A --> B["RetrieveObject via BOF<br>data portal"]
	B --> C["BeforeRetrieve assigns<br>RetrieveSQL, binds apolicynum"]
	C --> D["Framework executes<br>pk73094_policy_data.getpolicy<br>against Oracle"]
	D --> E["AfterRetrieve reads<br>first row via reader"]
	E --> F{Row returned?}
	F -->|Yes| G["Fill hydrates clsPolicyData<br>fields, MarkOld"]
	F -->|No| H["clsPolicyData remains<br>unpopulated/default"]
	G --> End(["Return populated<br>clsPolicyData"])
	H --> End
```

## Failure and edge-case behavior
- No row returned: the object is returned unpopulated rather than raising an exception or returning `Nothing` — callers must check `IsValid`/`PolicyNum` themselves.*
- The `GetPolicyData` overload taking an `inPolicyNumbers` array has no partial-failure handling: if one lookup throws, the exception propagates and no partial list is returned.*

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Business.View.Policy/clsPolicyData.vb`
